home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
TPUG - Toronto PET Users Group
/
TPUG Users Group CD
/
TPUG Users Group CD.iso
/
AMIGA
/
AMICUS
/
AMICUS26.ADF
/
SoundScape
/
AztecExamples
/
skeleton.c
< prev
next >
Wrap
C/C++ Source or Header
|
1989-01-26
|
3KB
|
140 lines
/* SKELETON.C Skeleton module for Aztec C.
(c) 1987 Todor Fay
*/
#include "exec/exec.h"
#include "exec/types.h"
#include "soundscape.h"
#include "intuition/intuition.h"
/* Images for input and output icons of the module. */
extern struct Image *inimage, *outimage;
/* Define your own state structure for edit routines. */
struct State {
long length; /* Always has a length field first. */
/* You supply remaining fields. */
};
/* Declare a state structure. */
struct State state = { sizeof(state) - 4, };
/* Pick an ID for your port, and a name. * /
#define PORT_ID 255
#define PORT_NAME "myportname"
/* The id for this port, returned by AddMidiPort: */
short thisport;
/* Base Pointers to SoundScape and Intuition */
long SoundScapeBase;
long IntuitionBase;
outcode(note)
/* This is your output routine. It is called by the packet
router whenever it has a MIDI event for you. Do something
with the event, then return.
Note the use of enteraztec() and leaveaztec().
*/
struct Note *note;
{
enteraztec();
FreeNode(note);
leaveaztec();
}
opencode(direction)
/* Depending on the direction, open the module for operation.
Return 1 if successful, 0 if not.
*/
char direction;
{
enteraztec();
if (direction) {
/* Code to init for sending events. */
}
else {
/* Code to init for receiving events. */
}
leaveaztec();
return(1);
}
closecode(direction)
{
enteraztec();
if (direction) {
/* Code to close down sending events. */
}
else {
/* Code to take care of stopping receiving events. */
}
leaveaztec();
return(1);
}
editcode(direction,command,buffer);
char direction;
char command;
struct State *buffer;
{
enteraztec();
switch (command) {
case USEREDIT :
if (direction) {
/* Your edit routine for left icon here. */
}
else {
/* Your edit routine for right icon here. */
}
break;
case SAVESTATE :
/* Your routine to save to a file here. */
case GETSTATE :
movmem(&state,buffer,sizeof(state));
break;
case LOADSTATE :
movmem(buffer,&state,sizeof(state));
state.length = (sizeof(state) - 4);
/* Your routine to load a file here. */
break;
case SETSTATE :
movmem(buffer,&state,sizeof(state));
state.length = (sizeof(state) - 4);
break;
}
leaveaztec();
}
main() {
IntuitionBase = OpenLibrary("intuition.library",0);
SoundScapeBase = OpenLibrary("soundscape.library",0);
if (SoundScapeBase) {
CloseLibrary(SoundScapeBase);
thisport = AddMidiPort(opencode,closecode,editcode,outcode,
&inimage,&outimage,PORT_ID,PORT_NAME);
SetTaskPri(FindTask(0),-20);
while (MidiPort(thisport)) Delay(100);
}
CloseLibrary(IntuitionBase);
}